package com.sq.partner.manager.dao;

import java.util.List;
import java.util.Map;

import com.sq.partner.manager.common.exception.AppException;
import com.sq.partner.manager.mybatis.model.GatewaySubChannel;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.mybatis.model.TradInsuPlanGroup;
import com.sq.partner.manager.mybatis.model.TreeDto;
import com.sq.partner.manager.util.Page;

/**
 * 合作伙伴子机构
 * @author Kang Zhiqiang
 *
 */
public interface IGatewaySubChannelDao extends BaseDao{
	
	/**
	 * 根据subChannelCode或subChannelName模糊查询subChannel
	 * @param pageIndex
	 * @param subChannel
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public Page<GatewaySubChannel> querySubChannelByFuzzyCriteria(Integer pageIndex,GatewaySubChannel subChannel,GatewayUser user) throws Exception;
	
	/**
	 * 获取传入的用户的权限机构及其子机构对应的合作伙伴及其合作伙伴子机构
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public Page<GatewaySubChannel> queryChannelTreeByOneUser(GatewayUser user,Page<GatewaySubChannel> page) throws Exception;
	
	/**
	 * 新增
	 * @param subChannel
	 * @return
	 * @throws Exception
	 */
	public boolean save(GatewaySubChannel subChannel) throws Exception;
	
	public boolean delete(String subChannelCode) throws Exception;
	
	public boolean delete1(Map<String, String> map) throws Exception;
	
	/**
	 * 根据subChannel属性查询相应的List<subChannel>
	 * @param subChannel
	 * @return
	 * @throws Exception
	 */
	public List<GatewaySubChannel> queryBySubChannel(GatewaySubChannel subChannel) throws Exception;
	
	/**
	 * 查询传入的合作伙伴的合作伙伴子机构Tree
	 * @param parentChannelCode
	 * @return
	 * @throws Exception
	 */
	public List<TreeDto> querySubChannelTreeByParentChannelCode(String parentChannelCode) throws Exception;
	
	public List<GatewaySubChannel> querySubChannelByParentCode(String parentCode) throws Exception;
	
	public void delDefaultSubChannel(String subChannelCode) throws Exception;

	public GatewaySubChannel querySubChannelInfoById(String subChannelCode) throws Exception;
	
	public GatewaySubChannel querySubChannelInfoByCondition(Map<String, String> map) throws Exception;

	public Page<GatewaySubChannel> queryPageForGatewaySubChannelInfo(Page<GatewaySubChannel> page) throws Exception;
	
	public void addBatchMtSubBranchInfo(List<GatewaySubChannel> list) throws AppException;
	
	/**
	 * 产品导出销售网点
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public  List<Map<String, Object>> impNlifeSub(Map<String, Object>map) throws Exception;

	public List<GatewaySubChannel> searchGatewaySubChannelsListByplanCode(
			Map<String, Object> maps) throws Exception;

}
